package main

import (
	"fmt"
)

func printBytes1(s string) {
	for i:= 0; i < len(s); i++ {
		fmt.Printf("%x ", s[i])
	}
}

func printChars1(s string) {
	//rune 表示一个代码点。代码点无论占用多少个字节，都可以用一个 rune 来表示
	runes := []rune(s)
	for i:= 0; i < len(runes); i++ {
		fmt.Printf("%c ",runes[i])
	}
}

func main() {
	name := "Hello World"
	printBytes1(name)
	fmt.Printf("\n")
	printChars1(name)
	fmt.Printf("\n\n")
	name = "Señor"
	printBytes1(name)
	fmt.Printf("\n")
	printChars1(name)
}